<?php

namespace App\Department\Controllers;

use App\Http\Controllers\Controller;
use App\Services\DashboardService;
use App\Services\StatisticServer;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;

class HomeController extends Controller
{
    protected $title = '工作台';

    protected $statisticServer;
    protected $dashboardService;

    public function __construct(DashboardService $dashboardService,StatisticServer $statisticServer)
    {
        $this->dashboardService = $dashboardService;
        $this->statisticServer = $statisticServer;
    }

    public function index(Content $content)
    {
        $admin = Admin::user();
        return $content
            ->title($this->title)
            ->description('  ')
            ->row(function (Row $row) use ($admin) {
                $row->column(6, function (Column $column) use ($admin) {
                    $column->append($this->dashboardService->applying2($admin));
                });
                $row->column(6, function (Column $column) use ($admin) {
                    $column->append($this->dashboardService->documents($admin));
                });
            })->row($this->dashboardService->agency());
    }
}
